from fastapi import APIRouter, Request
from app.parameter import CreateDatabaseParam, QueryDatabasesParam
from app.service import DatabaseService
from app.utils import getUserInfo

router = APIRouter(tags=["群组路由"])
from utils import DEBUG

@router.post("/database/create")
async def create(createDatabaseParam: CreateDatabaseParam, request: Request):
    DEBUG(createDatabaseParam)
    userId = getUserInfo(request)
    return DatabaseService.createDatabase(createDatabaseParam, userId)

@router.post("/database/querys")
async def querys(queryDatabasesParam :QueryDatabasesParam,request: Request):
    userId = getUserInfo(request)
    return DatabaseService.queryDatabases(queryDatabasesParam, userId)

# @router.post("/database/delete")
# async def delete(deleteHubParam: DeleteHubParam, request: Request):
#     DEBUG(deleteHubParam)
#     userId = getUserInfo(request)
#     return HubService.deleteHub(deleteHubParam, userId)

# @router.post("/database/query")
# async def query(queryHubParam: QueryHubParam, request: Request):
#     DEBUG(queryHubParam)
#     userId = getUserInfo(request)
#     return HubService.queryHub(queryHubParam, userId)


